package org.firefly.job;

import org.firefly.service.TimeCapsuleService;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CapsuleOpenJob implements Job {

    @Autowired
    private TimeCapsuleService capsuleService;

    @Override
    public void execute(JobExecutionContext context) {
        JobDataMap dataMap = context.getJobDetail().getJobDataMap();
        Long capsuleId = dataMap.getLong("capsuleId");
        capsuleService.openCapsule(capsuleId);
    }
}